<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>login.jsp</title>
</head>
<body>

<h2>javax.servlet.http.HttpSession - session 对象</h2> 
<form action=login.jsp method="POST" >
Login Name: <input type="text" name="Name"><br>
Login Password: <input type="text" name="Password" ><br>
<input type="submit" value="Send"><br>
</form>

<% if (request.getParameter("Name") != null &&
request.getParameter("Password") != null) { 
String Name = request.getParameter("Name");
String Password = request.getParameter("Password");

if (Name.equals("mike") && Password.equals("1234")) { 
session.setAttribute("Login", "OK");
response.sendRedirect("Member.jsp");
}
else { 
out.println("登录错误，请输入正确名称"); 
} 
}
%>
</body>
</html>
